<template>
    <div>
        {{orders}}
    </div>
</template>
<script>
import {switchMap,of,scheduled} from 'rxjs'
import { delay } from 'rxjs/operators';
export default {
    data(){
        return {orders:'loading....'}
    },
    mounted(){
        const user$ = of({
            uid:Math.random()
        })
        
        const fetchOrders = (id) => of([`${id}'s order data`]).pipe(delay(1000))

        user$.subscribe(user => fetchOrders(user.uid).subscribe(data => {
            this.orders = data            
        }))
    }
}
</script>